from PyQt5.QtWidgets import QMessageBox
'''
消息框工具类，提供警告 通知 询问三种方式
'''

def warning(title: str, text: str, buttons = QMessageBox.Ok):
    msgbox = QMessageBox()
    msgbox.setIcon(QMessageBox.Warning)  # 设置图标
    msgbox.setWindowTitle(title)  # 设置标题
    msgbox.setText(text)  # 设置内容
    msgbox.setEscapeButton(buttons)  # 返回用户点击结果
    reply = msgbox.exec()
    return reply

def warning(title: str, text: str, buttons= QMessageBox.Ok):
    msgbox = QMessageBox()
    msgbox.setIcon(QMessageBox.Information)
    msgbox.setWindowTitle(title)
    msgbox.setText(text)
    msgbox.setEscapeButton(buttons)
    reply = msgbox.exec()
    return reply

# def warning(title: str, text: str, buttons):
#     msgbox = QMessageBox()
#     msgbox.setIcon(QMessageBox.Question)
#     msgbox.setWindowTitle(title)
#     msgbox.setText(text)
#     msgbox.setEscapeButton(buttons)
#     reply = msgbox.exec()
#     return reply
